use std::fmt::{self};

// 定义一个包含单个 `Vec` 的结构体 `List`。
struct List(Vec<i32>);
impl fmt::Display for List {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        let vec = &self.0;
        write!(f, "[")?;
        for (count, v) in vec.iter().enumerate() {
            write!(f, "{}:{}",count, v)?;
            if count != vec.len() - 1 {
                write!(f, ", ")?;
            }
        }
        write!(f, "]")
    }
}
pub fn my_list() {
    let v = List(vec![1, 2, 3]);
    println!("{}", v);
}

